package com.aifund.common.entity;

import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 用户绑定交易所
 */
@Entity
@Data
@SQLDelete(sql = "update ai_user_bin_exchange set delete = 1 where id = ?")
@Where(clause = "is_del = 0")
@EntityListeners(AuditingEntityListener.class)
public class AiUserBindExchange implements Serializable {

    @Id
    @GeneratedValue
    private Long id;

    /**
     * 用户ID
     */
    private Long aiUserId;

    /**
     * 交易所ID
     */
    private Long aiExchangeId;

    private String apiKey;

    private String apiSecret;

    @CreatedDate
    @Column(name = "createTime",updatable = false,nullable = false)
    private Date createTime;

    @LastModifiedDate
    @Column(name = "updateTime",nullable = false)
    private Date updateTime;

    @Type(type = "org.hibernate.type.NumericBooleanType")
    private Boolean isDel = false;

}

